#include <queue>
#include <functional> //greater算法的头文件
#include <vector>
#include <iostream>

using namespace std;

int main()
{
    //默认情况下,创建的是大堆,其底层按照小于号(less)进行比较
    vector<int> v1{2,5,6,9,2,5,8,30,77,110,99};

    priority_queue<int> pr_qu1;
    
    for (int e : v1)
    {
        pr_qu1.push(e);
    }

   cout << "pr_qu1 size is: " << pr_qu1.size() << endl;

    while(!pr_qu1.empty())
    {
        cout << pr_qu1.top() << " ";
        pr_qu1.pop();
    }
    cout << endl;

    //如果要创建小堆,将第三个模板参数换成greater比较方式
   priority_queue<int, vector<int>, greater<int>> pr_qu2(v1.begin(), v1.end());

   cout << "pr_qu2 size is: " << pr_qu2.size() << endl;

   while(!pr_qu2.empty())
   {
       cout << pr_qu2.top() << " ";
       pr_qu2.pop();
   }
   cout << endl;


    return 0;
}
